package com.party.core.service.school.impl;

import com.google.common.base.Strings;
import com.party.common.paging.Page;
import com.party.core.dao.read.school.ScScoreReadDao;
import com.party.core.dao.write.school.ScScoreWriteDao;
import com.party.core.model.BaseModel;
import com.party.core.model.school.ScScore;
import com.party.core.service.school.IScScoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Set;

@Service
public class ScScoreService implements IScScoreService {
    @Autowired
    private ScScoreReadDao scScoreReadDao;
    @Autowired
    private ScScoreWriteDao scScoreWriteDao;

    @Override
    public String insert(ScScore scScore) {
        BaseModel.preInsert(scScore);
        if (scScoreWriteDao.insert(scScore)) {
            return scScore.getId();
        }
        return null;
    }

    @Override
    public boolean update(ScScore scScore) {
        scScore.setUpdateDate(new Date());
        return scScoreWriteDao.update(scScore);
    }

    @Override
    public boolean deleteLogic(String id) {
        return false;
    }

    @Override
    public boolean delete(String id) {
        if (Strings.isNullOrEmpty(id)) {
            return false;
        }
        return scScoreWriteDao.delete(id);
    }

    @Override
    public boolean batchDeleteLogic(Set<String> ids) {
        return false;
    }

    @Override
    public boolean batchDelete(Set<String> ids) {
        return false;
    }

    @Override
    public ScScore get(String id) {
        if (Strings.isNullOrEmpty(id)) {
            return null;
        }
        return scScoreReadDao.get(id);
    }

    @Override
    public List<ScScore> listPage(ScScore scScore, Page page) {
        return scScoreReadDao.listPage(scScore, page);
    }

    @Override
    public List<ScScore> list(ScScore scScore) {
        return scScoreReadDao.listPage(scScore, null);
    }

    @Override
    public List<ScScore> batchList(Set<String> ids, ScScore scScore, Page page) {
        return null;
    }
}
